package com.hxgis.oc.util.ds;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class FileDatabaseManager {
    private final Map<String,FileDatabase> fileDatabaseMap = new ConcurrentHashMap<>();

    public FileDatabase add(String name,String fileName) throws Exception {
        if(fileDatabaseMap.containsKey(name)){
            throw new Exception("已存在键");
        }
        FileDatabase fileDatabase = new FileDatabase(fileName);
        fileDatabaseMap.put(name,new FileDatabase(fileName));
        return fileDatabase;
    }

    public FileDatabase get(String name)
    {
        return fileDatabaseMap.get(name);
    }
}
